﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>首页</title>
    <link rel="icon" href="${pageContext.request.contextPath}/image/logo_b.png" type="image/x-icon"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/base.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/nav.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/mask.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/index.css">
</head>
<body>
<jsp:include page="common/nav.jsp"/>
<div class="main">
    <div class="content">
        <div class="list-title">
            <div class="title-text">&nbsp;&nbsp;最新动态</div>
        </div>
        <%--最新动态列表--%>
        <div id="feedList" class="feed-list">
            <c:forEach items="${pageInfo.list}" var="answer">
                <div class="feed-item">
                    <div class="avatar">
                        <a href="javascript:showUserMask(${answer.userId});">
                            <img src="${answer.user.avatarUrl}">
                        </a>
                    </div>
                    <div class="feed-body">
                        <div class="feed-source">
                            <a href="javascript:showUserMask(${answer.userId});">${answer.user.name}</a>
                            <span>&nbsp;回答了问题</span>
                            <span>&nbsp;•&nbsp;</span>
                            <span class="timeNeedConvert">${answer.time}</span>
                        </div>
                        <h2 class="feed-title">
                            <a href="${pageContext.request.contextPath}/ques/${answer.questionId}">${answer.question.title}</a>
                        </h2>
                        <div class="feed-user-info">
                            <a href="#">${answer.user.name}</a>
                            <span class="comma">，</span>
                            <span>${answer.user.simDesc}</span>
                        </div>
                        <div class="feed-content">${answer.content}</div>
                    </div>
                </div>
            </c:forEach>
            <div id="pagination"></div>
        </div>
    </div>
    <%--右侧栏--%>
    <div class="sidebar">
        <jsp:include page="common/sidebar.jsp"/>
        <jsp:include page="common/footer.jsp"/>
    </div>
</div>
<jsp:include page="common/mask.jsp"/>

<script type="text/javascript" src="${pageContext.request.contextPath}/js/MyConverter.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/myPagination.js"></script>
<script>
    $(function () {
        var div = $("#pagination");
        var curPage = ${pageInfo.pageNum};
        var allPage = ${pageInfo.pages};
        var length = 5;
        paginationConstructor(div, length, curPage, allPage);
    });
</script>
</body>
</html>

